import axios from '@/utils/request';
const baseUserURL = process.env.VUE_APP_USER_API;
const baseURL = process.env.VUE_APP_COMMON_API;
const baseMaintenanceURL = process.env.VUE_APP_MAINTENANCE_API;
const baseProjectURL = process.env.VUE_APP_PROJECT_API;

// 默认方式
const demoGet = () => {
  return axios.get(baseUserURL + '/userList');
};

//获取部门列表
const getDepartmentList = data => {
  return axios.get(baseUserURL + '/organization/getDepartmentList',{
    params: data
  });
};
//获取客户列表
const getCustomerList = data => {
  return axios.get(baseMaintenanceURL + '/maintenance/getCustomerList',{
    params: data
  });
};
//获取客户项目
const getProjectList = data => {
  return axios.get(baseProjectURL + '/project/getProjectList',{
    params: data
  });
};

// 按年份月份获取通知统计
const getNoticeCount = data => {
  return axios.get(baseMaintenanceURL + '/maintenance/getNoticeCount',{
    params: data
  });
};
// 查询工单统计
const getYearOrderCount = data => {
  return axios.get(baseMaintenanceURL + '/maintenance/getYearOrderCount',{
    params: data
  });
};
//按报警等级获取通知统计
const getNoticeGradeCount = data => {
  return axios.get(baseMaintenanceURL + '/maintenance/getNoticeGradeCount',{
    params: data
  });
};
//查询工单top10
const getOrderTop = data => {
  return axios.get(baseMaintenanceURL + '/maintenance/getOrderTop',{
    params: data
  });
};




// 自定义请求方式
const demoPut = data => {
  return axios.request({
    method: 'PUT',
    url: baseUserURL + '/user/realNameAuthentication',
    data,
    headers: {
      hideLoading: true, //是否显示loading
      loadingText: encodeURI('实名认证中，请稍候...'), //loading加载文字
      'Content-Type': 'application/x-www-form-urlencoded'
    }
  });
};

export {demoGet,
   demoPut,
   getDepartmentList,
   getCustomerList,
   getProjectList,
   getOrderTop,
   getNoticeGradeCount,
   getYearOrderCount,
   getNoticeCount
   };
